package domd3;

public class Main {
    public static void main(String[] args) {
        //String类
        long start=System.currentTimeMillis();//毫秒
        String s=" ";
        for (int i = 0; i < 10000; i++) {
            s+=i;
        }
        long end=System.currentTimeMillis();
        System.out.println(end - start);
        //StringBuffer类
        start=System.currentTimeMillis();
        StringBuffer sbf=new StringBuffer(" ");
        for (int i = 0; i < 10000; i++) {
            sbf.append(i);
        }
        end=System.currentTimeMillis();
        System.out.println(end - start);
        //StringBuilder类
        StringBuilder sbd=new StringBuilder(" ");
        for (int i = 0; i < 10000; i++) {
            sbd.append(i);
        }
        end=System.currentTimeMillis();
        System.out.println(end - start);
    }
}
